package dd.prog2.exercises.set07;

public class SphericalTank extends Tank{

	private double r;

	public SphericalTank(double r) {
		this.r = r;
		this.setType("Spherical");
	}

	public double getR() {
		return r;
	}

	public void setR(double r) {
		this.r = r;
	}

	@Override
	public double calcSurface() {
		return 4*pi*r*r;
	}

	@Override
	public double calcVolume() {
		return (4/3)*r*r*r*pi;
	}

	@Override
	public String toString() {
		String res = "Sperical Tank:\n";
		res += this.getType()+". Surface: "+df.format(this.calcSurface())+". Volume: "+df.format(this.calcVolume())+"\n";
		return res;
	}

	@Override
	protected SphericalTank clone() throws CloneNotSupportedException {
		SphericalTank t = new SphericalTank(this.r);
		return t;
	}

}
